package com.nut.course.api.biz;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nut.course.common.Result;
import com.nut.course.entity.Partner;
import com.nut.course.service.PartnerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//学校端 查看机构
@Slf4j
@RestController
@RequestMapping("/schoolPartner")
public class SchoolPartnerController {

    @Autowired
    private PartnerService partnerService;

    @GetMapping("list")
    public Result<IPage<Partner>> list(
            @RequestParam String status,
            @RequestParam String name,
            @RequestParam(defaultValue = "1") Integer pageNo,
            @RequestParam(defaultValue = "10") Integer pageSize) {

        //查看所有机构
        return partnerService.list(status, name, pageNo, pageSize);
    }

    @GetMapping(value = "/{id}")
    public Result<Partner> detail(@PathVariable Integer id) {
        return partnerService.getById(id);
    }


}
